package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppMarketAccessMapper;
import com.ep.modules.app.entity.AppMarketAccess;
import com.ep.modules.app.entity.AppMarketAccessExample;
import com.ep.modules.app.service.AppMarketAccessService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppMarketAccessServiceImpl implements AppMarketAccessService {
    @Autowired
    private AppMarketAccessMapper appMarketAccessMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppMarketAccessExample example = new AppMarketAccessExample();
        AppMarketAccessExample.Criteria criteria = example.createCriteria();
        List<AppMarketAccess> list = appMarketAccessMapper.selectByExample(example);
        Page<AppMarketAccess> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppMarketAccess getById(Long id) {
        return appMarketAccessMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppMarketAccess entity) {
        appMarketAccessMapper.insert(entity);
    }

    public void update(AppMarketAccess entity) {
        appMarketAccessMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appMarketAccessMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}